{extend name="platform/base" /} 
{block name="resources"}
<style>
.right-indent:after{
	content:'';
	display:inline-block;
	width:30%;
}
</style>
{/block}
{block name="main"}
<div class="row padder-v">
	<div class="col-sm-9">
		<a href="{:__URL('PLATFORM_MAIN/Shop/addShopLevel')}"
			class="btn btn-sm btn-primary"><i class="fa fa-plus"></i> 添加店铺等级
		</a>
	</div>
	<div class="col-sm-2">
		<input type="text" id="search_text" class="input-sm form-control"
			placeholder="请输入等级名称">
	</div>
	<div class="col-sm-1">
		<button class="btn btn-sm btn-default" type="button"
			onclick="LoadingInfo(1)">搜索</button>
	</div>
</div>
<section class="panel panel-default">
	<table class="table table-striped b-light text-sm">
		<colgroup>
				<col width="3%">
				<col width="15%">
				<col width="15%">
				<col width="15%">
				<col width="15%">
				<col width="20%">
				<col width="17%">
		</colgroup>
		<thead>
			<tr>
				<th><input type="checkbox"></th>
				<th>等级名称</th>
				<th class="right right-indent">年费（元/年）</th>
				<th class="center">自营状态</th>
				<th class="center">等级状态</th>
				<th class="center">更新时间</th>
				<th class="center">操作</th>
			</tr>
		</thead>
		<tbody id="list">
			<tr></tr>
		</tbody>
	</table>
	{include file="platform/page" /}
</section>

{/block} {block name="script"}
<script type="text/javascript">
$(function(){
	LoadingInfo(1);
});
//查询用户列表
	function LoadingInfo(pageIndex) {
		var search_text = $("#search_text").val();
		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/Shop/shopLevelList')}",
			async : true,
			data : {
				"pageIndex" : pageIndex, "search_text" : search_text
			},
			success : function(data) {
				var html = '';
				$("#total_count_num").text(data["total_count"]);
				$("#page_count_num").text(data["page_count"]);
				$("#page_count").val(data["page_count"]);
				$("#pageNumber a").remove();
				if (data["data"].length > 0) {
					for (var i = 0; i < data["data"].length; i++) {
						html += '<tr>';
						html += '<td><input type="checkbox" name="sub" value="'+ data['data'][i]['instance_typeid']+'"></td>';
						html += '<td>' + data["data"][i]["type_name"] + '</td>';
						html += '<td class="right right-indent">' + data["data"][i]["annual_fee"] + '</td>';
						
						if(data["data"][i]["is_self_support"] == 1){
							html += '<td class="center">是</td>';
						}else{
							html += '<td class="center">否</td>';
						}
						
						if(data["data"][i]["is_open_level"] == 1){
							html += '<td class="center">开启</td>';
						}else{
							html += '<td class="center">禁用</td>';
						}
						
						html += '<td class="center">' + timeStampTurnTime(data["data"][i]["modify_time"]) + '</td>';
						html += '<td class="center"><a href="'+ __URL('PLATFORM_MAIN/Shop/updateShopLevel?instance_typeid='+ data['data'][i]['instance_typeid'])+'">修改</a></td>';
						html += '</tr>';
					}
				} else {
					html += '<tr class="center"><td colspan="7">暂无店铺等级数据记录</td></tr>';
				}
				$("#list").html(html);
					var totalpage = $("#page_count").val();
			if (totalpage == 1) {
				changeClass("all");
			}
			var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
			$("#pageNumber").append($html);
			}
		});
	}	
	$("#search_text").keypress(function(e){
		if(e.keyCode == 13){
			LoadingInfo(1);
		}
	});
</script>
{/block}
